<template>
    <div>
        <whatever :list="list"></whatever>
    </div>
</template>
<script>
import axios from 'axios'
import Vue from 'vue'
export default {
  data () {
    return {
      list: []
    }
  },
  mounted () {
    // 设置axios为form-data
    axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'
    axios.defaults.headers.get['Content-Type'] = 'application/x-www-form-urlencoded'
    axios.defaults.transformRequest = [function (data) {
      let ret = ''
      for (const it in data) {
        ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
      }
      return ret
    }]
    // 然后再修改原型链
    Vue.prototype.$axios = axios

    console.log(this.$route.params.id)
    axios.post('/lct?api_version=te_1.0.0&platType=2&client=wap&isEncry=0&time=1583408964832&act=world&op=product_list', {
      id: this.$route.params.id
    }).then(res => {
      this.list = res.data.datas[0]
      console.log('aaa', this.list)
    })
  }
}
</script>
